package com.bbva.kyfb.kyfbjpatlbh.dominiotlbh;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Embeddable;

import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.roo.addon.entity.RooIdentifier;

import flexjson.JSONDeserializer;
import flexjson.JSONSerializer;

/**
 * The Class TtlsbfuaPK.
 */
@Configurable
@Embeddable
@RooIdentifier(dbManaged = true)
public final class TtlsbfuaPK implements java.io.Serializable {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 1L;

	/** The cod cliecash. */
	@Column(name = "COD_CLIECASH", nullable = false,columnDefinition = "CHAR", length = 16)
    private String codCliecash;

	/** The cod claseord. */
	@Column(name = "COD_CLASEORD", nullable = false,columnDefinition = "CHAR", length = 3)
    private String codClaseord;

	/** The cod idorden. */
	@Column(name = "COD_IDORDEN", nullable = false,columnDefinition = "CHAR", length = 8)
    private String codIdorden;

	/** The cod accion. */
	@Column(name = "COD_ACCION", nullable = false)
    private Short codAccion;

	/** The cod idaccion. */
	@Column(name = "COD_IDACCION", nullable = false)
    private Integer codIdaccion;

	/**
	 * Instantiates a new ttlsbfua pk.
	 *
	 * @param codCliecash the cod cliecash
	 * @param codClaseord the cod claseord
	 * @param codIdorden the cod idorden
	 * @param codAccion the cod accion
	 * @param codIdaccion the cod idaccion
	 */
	public TtlsbfuaPK(String codCliecash, String codClaseord, String codIdorden, Short codAccion, Integer codIdaccion) {
        super();
        this.codCliecash = codCliecash;
        this.codClaseord = codClaseord;
        this.codIdorden = codIdorden;
        this.codAccion = codAccion;
        this.codIdaccion = codIdaccion;
    }

	/**
	 * Instantiates a new ttlsbfua pk.
	 */
	@SuppressWarnings("unused")
	private TtlsbfuaPK() {
        super();
    }

	/**
	 * Gets the cod cliecash.
	 *
	 * @return the cod cliecash
	 */
	public String getCodCliecash() {
        return this.codCliecash;
    }

	/**
	 * Gets the cod claseord.
	 *
	 * @return the cod claseord
	 */
	public String getCodClaseord() {
        return this.codClaseord;
    }

	/**
	 * Gets the cod idorden.
	 *
	 * @return the cod idorden
	 */
	public String getCodIdorden() {
        return this.codIdorden;
    }

	/**
	 * Gets the cod accion.
	 *
	 * @return the cod accion
	 */
	public Short getCodAccion() {
        return this.codAccion;
    }

	/**
	 * Gets the cod idaccion.
	 *
	 * @return the cod idaccion
	 */
	public Integer getCodIdaccion() {
        return this.codIdaccion;
    }

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;
        if (!(obj instanceof TtlsbfuaPK)) return false;
        TtlsbfuaPK other = (TtlsbfuaPK) obj;
        if (codCliecash == null) {
            if (other.codCliecash != null) return false;
        } else if (!codCliecash.equals(other.codCliecash)) return false;
        if (codClaseord == null) {
            if (other.codClaseord != null) return false;
        } else if (!codClaseord.equals(other.codClaseord)) return false;
        if (codIdorden == null) {
            if (other.codIdorden != null) return false;
        } else if (!codIdorden.equals(other.codIdorden)) return false;
        if (codAccion == null) {
            if (other.codAccion != null) return false;
        } else if (!codAccion.equals(other.codAccion)) return false;
        if (codIdaccion == null) {
            if (other.codIdaccion != null) return false;
        } else if (!codIdaccion.equals(other.codIdaccion)) return false;
        return true;
    }

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
        final int prime = 31;
        int result = 17;
        result = prime * result + (codCliecash == null ? 0 : codCliecash.hashCode());
        result = prime * result + (codClaseord == null ? 0 : codClaseord.hashCode());
        result = prime * result + (codIdorden == null ? 0 : codIdorden.hashCode());
        result = prime * result + (codAccion == null ? 0 : codAccion.hashCode());
        result = prime * result + (codIdaccion == null ? 0 : codIdaccion.hashCode());
        return result;
    }

	/**
	 * To json.
	 *
	 * @return the string
	 */
	public String toJson() {
        return new JSONSerializer().exclude("*.class").serialize(this);
    }

	/**
	 * From json to ttlsbfua pk.
	 *
	 * @param json the json
	 * @return the ttlsbfua pk
	 */
	public static TtlsbfuaPK fromJsonToTtlsbfuaPK(String json) {
        return new JSONDeserializer<TtlsbfuaPK>().use(null, TtlsbfuaPK.class).deserialize(json);
    }

	/**
	 * To json array.
	 *
	 * @param collection the collection
	 * @return the string
	 */
	public static String toJsonArray(Collection<TtlsbfuaPK> collection) {
        return new JSONSerializer().exclude("*.class").serialize(collection);
    }

	/**
	 * From json array to ttlsbfua p ks.
	 *
	 * @param json the json
	 * @return the collection
	 */
	public static Collection<TtlsbfuaPK> fromJsonArrayToTtlsbfuaPKs(String json) {
        return new JSONDeserializer<List<TtlsbfuaPK>>().use(null, ArrayList.class).use("values", TtlsbfuaPK.class).deserialize(json);
    }
}
